include config.mk

ccsrcs := $(wildcard src/*.cc)
ccobjs := $(patsubst src/%.cc,obj/%.o,$(ccsrcs))

csrcs := $(wildcard src/*.c)
cobjs := $(patsubst src/%.c,obj/%.o,$(csrcs))

cusrcs := $(wildcard src/*.cu)
cuobjs := $(patsubst src/%.cu,obj/%.o,$(cusrcs))

all: libmri.o
	make -C l1spirit
	

allobjs := $(cuobjs) $(ccobjs) $(cobjs)

libmri.o: $(allobjs)
	$(ld) -r $^ -o $@

obj/%.o: src/%.cc
	$(c++) -c $^ -o $@ $(cppflags) $(c++flags) 

obj/%.o: src/%.c
	$(c++) -x c -c $^ -o $@ $(cppflags) $(c++flags) 

obj/%.o: src/%.cu
	$(nvcc) -c $^ -o $@ $(nvccflags) $(cppflags) 

clean:
	rm -f $(allobjs) libmri.o

mrclean: clean
	make -C l1spirit clean


